import request from "@/utils/request";
import { Alipay } from "@/types/alipay";

const baseApi = '/alipay';

/**
 *  获取支付宝列表
 * @param params 
 * @returns 
 */
export const getAlipayListApi = (params: { pageNo: number; pageSize: number }) => {
    return request({
      url: baseApi+'/list',
      method: 'get',
      params
    })  
  }

  /**
   * 新增或更新支付宝
   * @param data 
   * @returns 
   */

  export const addOrUpdateAlipayApi = (data: Alipay,isEdit:boolean) => {
    return request({
      url: baseApi,
      method: isEdit?'put':'post',
      data
    })  
  }

  /**
   * 删除支付宝
   */
  export const deleteAlipayApi = (id:number) => {
    return request({
      url: baseApi+`/${id}`,
      method: 'delete'
    })  
  }

  /**
   * 更新状态
   */
  export const switchStatusApi = (id: number) => {
    return request({
      url: baseApi+'/status/'+id,
      method: 'put'
    })  
  }